using System;
using System.Collections.Generic;

namespace CPlatePrintSys.Domain.Models
{
    /// <summary>
    /// 工作空间模型
    /// </summary>
    public class WorkSpace
    {
        public int Id { get; set; }
        public string Name { get; set; }
        public string Description { get; set; }
        public DateTime CreatedAt { get; set; }
        public DateTime LastModifiedAt { get; set; }
        public string CreatedBy { get; set; }
        public bool IsActive { get; set; }
        
        // 工作空间节点信息（JSON格式存储）
        public string WorkSpaceNodesJson { get; set; }
        
        // 导航属性
        public virtual List<WorkSpaceNode> WorkSpaceNodes { get; set; } = new List<WorkSpaceNode>();
    }

    /// <summary>
    /// 工作空间节点模型
    /// </summary>
    public class WorkSpaceNode
    {
        public int Id { get; set; }
        public int WorkSpaceId { get; set; }
        public string Name { get; set; }
        public string NodeType { get; set; } // Ship, Lot, Sequence
        public string NodeValue { get; set; } // 具体的值，如船号、LOT号等
        public int? ParentNodeId { get; set; }
        public int SortOrder { get; set; }
        public bool IsSelected { get; set; }
        public List<WorkSpaceNode> Children { get; set; } = new List<WorkSpaceNode>();
        public WorkSpaceNode Parent { get; set; }

        public WorkSpaceNode()
        {
            Children = new List<WorkSpaceNode>();
        }

        public WorkSpaceNode(string name) : this()
        {
            Name = name;
        }

        public WorkSpaceNode(string name, WorkSpaceNode parent) : this(name)
        {
            Parent = parent;
        }
    }

    /// <summary>
    /// 工作空间记录模型（用于首页显示）
    /// </summary>
    public class WorkSpaceRecord
    {
        public int Id { get; set; }
        public string Name { get; set; }
        public string Description { get; set; }
        public DateTime LastModifiedAt { get; set; }
        public string CreatedBy { get; set; }
        public int NodeCount { get; set; }
        public string PreviewInfo { get; set; } // 预览信息，如 "N1958 (A101A、A102A、A103A......)"
    }
} 